/*
 * cc_html_interface.h
 *
 *  Created on: 2009-7-24
 *      Author: sony
 */

#ifndef CC_HTML_INTERFACE_H_
#define CC_HTML_INTERFACE_H_

using namespace std;

enum NodeType {
	ntFile = 0x0001,
	ntProj = 0x0002,
	ntCom = 0x0004,
	ntMod = 0x0008,
	ntSmod = 0x0010
};

class VoilationImp {
private:
	string name;
	string path;
	string description;
	string abs_path;

	int line;

	int mvg;

public:
	VoilationImp(string s) {
		name = s;
		path = "";
		description = "";
		line = 1;
	}

	string get_abs_path() {
		return abs_path;
	}

	void set_abs_path(string s) {
		this->abs_path = s;
	}

	void set_name(string n) {
		name = n;
	}

	void set_path(string p) {
		path = p;
	}

	void set_description(string d) {
		description = d;
	}

	void set_line(int l) {
		line = l;
	}

	string& get_name() {
		return name;
	}

	string& get_path() {
		return path;
	}

	string& get_description() {
		return description;
	}

	int get_line() {
		return line;
	}

	int getMvg() const {
		return mvg;
	}

	void setMvg(int mvg) {
		this->mvg = mvg;
	}
};

class NodeImp {
private:
	int NOC;
	int NOM;
	int NOSM;
	int NOF;
	int NOFA;
	int LOC;

	int SLOC;

	int MVG;
	int NOV;

	int FANIN;
	int FANOUT;
	int NONDVH;
	int NODDIMI;
	int NOAI;

	int NOSIISC;
	int LOC_R;
	int LOC_T;

	float PROJECT_R;

	int COM;

	int L_C;
	int M_C;
	int IF4;
	int IF4v;
	int IF4c;

	int WMC1;
	int WMCv;
	int DIT;
	int NOCH;
	int COB;

	int type;

	string path;
	string name;

	string abs_path;

	NodeImp * parent;

	std::vector<NodeImp*> children;

	std::vector<VoilationImp*> voilation;

	std::vector<VoilationImp*> direct_data;

	std::vector<VoilationImp*> abs_interface;

	std::vector<VoilationImp*> header;

	std::vector<VoilationImp*> fanin;

	std::vector<VoilationImp*> fanout;

	std::vector<VoilationImp*> funcs;

	int LineOfCode;
	int LineOfComm;
	int LineOfSrc;
	int NumOfSpeIf;

	int SharedLineOfCode;
	int ShardNumOfSpeIf;

public:
	NodeImp(string s) {
		name = s;
		NOC = -1;
		NOM = -1;
		NOSM = -1;
		NOF = -1;
		NOFA = -1;
		LOC = -1;
		MVG = -1;
		NOV = -1;

		FANIN = -1;
		FANOUT = -1;
		NONDVH = 0;
		NODDIMI = -1;
		NOAI = -1;

		NOSIISC = -1;
		LOC_R = -1;
		LOC_T = -1;

		PROJECT_R = -1;

		COM = -1;

		L_C = -1;
		M_C = -1;
		IF4 = -1;
		IF4v = -1;
		IF4c = -1;

		WMC1 = -1;
		WMCv = -1;
		DIT = -1;
		NOCH = -1;
		COB = -1;

		type = ntMod;

		LineOfCode = -1;
		LineOfComm = -1;
		LineOfSrc = -1;
		NumOfSpeIf = -1;

		SharedLineOfCode = 0;
		ShardNumOfSpeIf = 0;
	}


	void add_violation(VoilationImp * v) {
		this->voilation.push_back(v);
	}

	int get_NOC() {
		return NOC;
	}

	int get_NOM() {
		return NOM;
	}

	int get_NOSM() {
		return NOSM;
	}

	int get_NOF() {
		return NOF;
	}

	int get_NOFA() {
		return NOFA;
	}

	int get_LOC() {
		return LOC;
	}

	int get_MVG() {
		return MVG;
	}

	int get_NOV() {
		if (this->voilation.size() < 1)
			return 0;
		return this->voilation.size();
	}

	int get_FANIN() {
		return fanin.size();
	}

	int get_FANOUT() {
		return fanout.size();
	}

	int get_NONDVH() {
		return NONDVH;
	}

	int get_NODDIMI() {
		return NODDIMI;
	}

	int get_NOAI() {
		return NOAI;
	}

	int get_NOSIISC() {
		return NOSIISC;
	}

	int get_LOC_REUSABLE() {
		return LOC_R;
	}

	int get_LOC_TOTAL() {
		return LOC_T;
	}

	float get_PROJECT_REUSABILITY() {
		return PROJECT_R;
	}

	/*description
	 * get_COM() return Lines of Comments
	 */
	int get_COM() {
		return COM;
	}

	/*
	 * get_L_C() return Lines of code per line of comment
	 */
	int get_L_C() {
		return L_C;
	}

	/*
	 * get_M_C() return Cyclomatic Complexity per line of comment
	 */
	int get_M_C() {
		return M_C;
	}

	int get_IF4() {
		return IF4;
	}

	int get_IF4v() {
		return IF4v;
	}

	int get_IF4c() {
		return IF4c;
	}

	/*
	 * Class level information
	 */
	int get_WMC1() {
		return WMC1;
	}

	int get_WMCv() {
		return WMCv;
	}

	int get_DIT() {
		return DIT;
	}

	int get_NOCH() {
		return NOCH;
	}

	int get_COB() {
		return COB;
	}

	/*
	 * Node information
	 */
	int get_type() {
		return type;
	}

	string& get_path() {
		return path;
	}

	string& get_name() {
		return name;
	}

	bool is_file() {
		if (type == ntFile)
			return true;
		return false;
	}

	int get_children_count() {
		return children.size();
	}

	NodeImp* get_parent() {
		return parent;
	}

	std::vector<NodeImp*>* get_children() {
		return (std::vector<NodeImp*>*) (((((&children)))));
	}

	std::vector<VoilationImp*> *get_voilation() {
		return (std::vector<VoilationImp*>*) (((((&voilation)))));
	}

	std::vector<VoilationImp*> *get_direct_data() {
		return (std::vector<VoilationImp*>*) (((((&direct_data)))));
	}

	std::vector<VoilationImp*> *get_abs_interface() {
		return (std::vector<VoilationImp*>*) (((((&abs_interface)))));
	}

	std::vector<VoilationImp*> *get_header() {
		return (std::vector<VoilationImp*>*) (((((&header)))));
	}

	std::vector<VoilationImp*> *get_fanin() {
		return (std::vector<VoilationImp*>*) (((((&fanin)))));
	}

	std::vector<VoilationImp*> *get_fanout() {
		return (std::vector<VoilationImp*>*) (((((&fanout)))));
	}

	void setAbs_interface(std::vector<VoilationImp*> abs_interface) {
		this->abs_interface = abs_interface;
	}

	void setCOB(int COB) {
		this->COB = COB;
	}

	void setCOM(int COM) {
		this->COM = COM;
	}

	void setChildren(std::vector<NodeImp*> children) {
		this->children = children;
	}

	void setDIT(int DIT) {
		this->DIT = DIT;
	}

	void setDirect_data(std::vector<VoilationImp*> direct_data) {
		this->direct_data = direct_data;
	}

	void setFANIN(int FANIN) {
		this->FANIN = FANIN;
	}

	void setFANOUT(int FANOUT) {
		this->FANOUT = FANOUT;
	}

	void setFanin(std::vector<VoilationImp*> fanin) {
		this->fanin = fanin;
	}

	void setFanout(std::vector<VoilationImp*> fanout) {
		this->fanout = fanout;
	}

	void setHeader(std::vector<VoilationImp*> header) {
		this->header = header;
	}

	void setIF4(int IF4) {
		this->IF4 = IF4;
	}

	void setIF4c(int IF4c) {
		this->IF4c = IF4c;
	}

	void setIF4v(int IF4v) {
		this->IF4v = IF4v;
	}

	void setLOC(int LOC) {
		this->LOC = LOC;
	}

	void setLOC_R(int LOC_R) {
		this->LOC_R = LOC_R;
	}

	void setLOC_T(int LOC_T) {
		this->LOC_T = LOC_T;
	}

	void setL_C(int L_C) {
		this->L_C = L_C;
	}

	void setMVG(int MVG) {
		this->MVG = MVG;
	}

	void setM_C(int M_C) {
		this->M_C = M_C;
	}

	void setNOAI(int NOAI) {
		this->NOAI = NOAI;
	}

	void setNOC(int NOC) {
		this->NOC = NOC;
	}

	void setNOCH(int NOCH) {
		this->NOCH = NOCH;
	}

	void setNODDIMI(int NODDIMI) {
		this->NODDIMI = NODDIMI;
	}

	void setNOF(int NOF) {
		this->NOF = NOF;
	}

	void setNOFA(int NOFA) {
		this->NOFA = NOFA;
	}

	void setNOM(int NOM) {
		this->NOM = NOM;
	}

	void setNONDVH(int NONDVH) {
		this->NONDVH = NONDVH;
	}

	void setNOSIISC(int NOSIISC) {
		this->NOSIISC = NOSIISC;
	}

	void setNOSM(int NOSM) {
		this->NOSM = NOSM;
	}

	void setNOV(int NOV) {
		this->NOV = NOV;
	}

	void setName(string name) {
		this->name = name;
	}

	void setPROJECT_R(float PROJECT_R) {
		this->PROJECT_R = PROJECT_R;
	}

	void setParent(NodeImp *parent) {
		this->parent = parent;
	}

	void setPath(string path) {
		this->path = path;
	}

	void setType(int type) {
		this->type = type;
	}

	void setVoilation(std::vector<VoilationImp*> voilation) {
		this->voilation = voilation;
	}

	void setWMC1(int WMC1) {
		this->WMC1 = WMC1;
	}

	void setWMCv(int WMCv) {
		this->WMCv = WMCv;
	}

	void addFanin(VoilationImp *v) {
		this->fanin.push_back(v);
	}

	void addFanout(VoilationImp *v) {
		this->fanout.push_back(v);
	}

	void addChild(NodeImp *node) {
		node->setParent(this);
		this->children.push_back(node);
	}

	string getAbs_path() const {
		return abs_path;
	}

	void setAbs_path(string abs_path) {
		this->abs_path = abs_path;
	}

	string get_str_type() {
		if (this->type == ntFile)
			return "file";

		if (this->type == ntProj)
			return "project";

		if (this->type == ntCom)
			return "component";

		if (this->type == ntMod)
			return "module";

		if (this->type == ntSmod)
			return "submodule";

	}
	int getLineOfCode() const {
		return LineOfCode;
	}

	int getLineOfComm() const {
		return LineOfComm;
	}

	int getLineOfSrc() const {
		return LineOfSrc;
	}

	int getNumOfSpeIf() const {
		return NumOfSpeIf;
	}

	void setLineOfCode(int LineOfCode) {
		this->LineOfCode = LineOfCode;
	}

	void setLineOfComm(int LineOfComm) {
		this->LineOfComm = LineOfComm;
	}

	void setLineOfSrc(int LineOfSrc) {
		this->LineOfSrc = LineOfSrc;
	}

	void setNumOfSpeIf(int NumOfSpeIf) {
		this->NumOfSpeIf = NumOfSpeIf;
	}

	int getSharedLineOfCode() const {
		return SharedLineOfCode;
	}

	void setSharedLineOfCode(int SharedLineOfCode) {
		this->SharedLineOfCode = SharedLineOfCode;
	}

	int getShardNumOfSpeIf() const {
		return ShardNumOfSpeIf;
	}

	void setShardNumOfSpeIf(int ShardNumOfSpeIf) {
		this->ShardNumOfSpeIf = ShardNumOfSpeIf;
	}

	//    std::vector<VoilationImp*>* getFuncs() const
	//    {
	//        return &funcs;
	//    }

	std::vector<VoilationImp*> *getFuncs() {
		return (std::vector<VoilationImp*>*) (((((&funcs)))));
	}

	void setFuncs(std::vector<VoilationImp*> funcs) {
		this->funcs = funcs;
	}

	void addFuncs(VoilationImp* func)
	{
		this->funcs.push_back(func);
	}
};

#endif /* CC_HTML_INTERFACE_H_ */
